#include "Stack.h"
#include "Queue.h"


//155. 最小栈
//https://leetcode.cn/problems/min-stack/

/*
class MinStack {
public:
    MinStack() {
    }

    void push(int val) {
        st.push(val);
        if (min_st.empty() || val <= min_st.top())
            min_st.push(val);
    }

    void pop() {
        if (st.top() == min_st.top())
            min_st.pop();
        st.pop();
    }

    int top() {
        return st.top();
    }

    int getMin() {
        return min_st.top();
    }

private:
    stack<int> st;
    stack<int> min_st;
};
*/

//JZ31 栈的压入、弹出序列
//https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106?tpId=13&&tqId=11174&rp=1&ru=/activity/oj&qru=/ta/coding-interviews/question-ranking

/*
class Solution {
public:
    static bool IsPopOrder(vector<int> pushV,vector<int> popV) {
        stack<int> st;
        int pop_i = 0, push_i = 0;
        while (push_i < pushV.size()){
            st.push(pushV[push_i++]);
            while (!st.empty() && st.top() == popV[pop_i]){
                st.pop();
                ++pop_i;
            }
        }
        return pop_i == pushV.size();
    }
};

void test1(){
    int push[] = {1,2,3,4,5};
    int pop[] = {4,5,3,2,1};
    int n = sizeof(push)/ sizeof(int);
    vector<int> v_push(push, push + n);
    vector<int> v_pop(pop, pop + n);
    cout << Solution::IsPopOrder(v_push, v_pop);
}
*/

int main() {
    //test1();
    Lu::Test1();
    Lu::Test2();
    return 0;
}
